{{define "infoCollection/baseInfo.html"}}
    <div>
        <!-- form start -->
        <form class="form-horizontal" id="baseInfoForm">
            <div class="box-body">
                <div class="form-group">
                    <label class="col-sm-2 control-label">行政区域：</label>
                    <div class="col-sm-4">
                        {{/*<input type="email" class="form-control" id="inputEmail3" placeholder="行政区域">*/}}
                        <select class="form-control" name="area" id="area" disabled>
                            <option value="100">巩义市</option>
                            <option value="200">中牟县</option>
                            <option value="300">管城区</option>
                            <option value="400">航空港实验区</option>
                            <option value="500">郑州市</option>
                        </select>
                    </div>
                    <label class="col-sm-2 control-label">筛查时间：</label>
                    <div class="col-sm-4">
                        <div class="input-group date">
                            <div class="input-group-addon">
                                <i class="fa fa-calendar"></i>
                            </div>
                            <input type="text" name="screenDate" id="screenDate" class="form-control pull-right"
                            >
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="idCard" class="col-sm-2 control-label">定点筛查机构：</label>
                    <div class="col-sm-4">
                        <select class="form-control" id="screenOrganCode" name="screenOrganCode" disabled>
                            <optgroup></optgroup>
                        </select>
                    </div>
                    <label class="col-sm-2 control-label" id="label_zhuyuanzhenghao"
                           style="display: none;">住院证号：</label>
                    <div class="col-sm-4" id="div_zhuyuanzhenghao" style="display: none;">
                        <input type="text" name="zhuyuanzhenghao" class="form-control" id="zhuyuanzhenghao"
                               placeholder="住院证号">
                    </div>
                </div>
                <div class="box box-info" style="box-shadow: none;margin-bottom: 0;">
                    <div class="box-header with-border">
                        <h3 class="box-title">人口学信息</h3>
                    </div>
                    <div class="box-body">
                        <div class="form-group">
                            <label for="userName" class="col-sm-2 control-label">姓名：</label>
                            <div class="col-sm-4">
                                <input type="text" name="userName" class="form-control" id="userName" placeholder="姓名">
                            </div>

                            <label for="idCard" class="col-sm-2 control-label">身份证号码：</label>
                            <div class="col-sm-4">
                                <input type="text" name="idCard" class="form-control" id="idCard" placeholder="身份证号码">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">性别：</label>
                            <div class="radio col-sm-2">
                                <input type="radio" name="userSex" value="男" class="minimal">男
                                <input type="radio" name="userSex" value="女" class="minimal">女
                            </div>
                            <label for="number" class="col-sm-2 control-label">年龄：</label>
                            <div class="col-sm-1">
                                <input type="text" name="age" class="form-control" id="age"
                                       placeholder="年龄">
                            </div>

                            <label for="nation" class="col-sm-2 control-label">民族:</label>
                            <div class="col-sm-1">
                                <input type="text" name="nation" class="form-control" id="nation" placeholder="民族">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">
                                婚姻状况：
                            </label>
                            <div class="radio col-sm-10">
                                <input type="radio" name="marital" value="未婚" class="minimal">未婚
                                <input type="radio" name="marital" value="已婚" class="minimal">已婚
                                <input type="radio" name="marital" value="丧偶" class="minimal">丧偶
                                <input type="radio" name="marital" value="离婚" class="minimal">离婚
                                <input type="radio" name="marital" value="其他" class="minimal">其他
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">
                                居住状况：
                            </label>
                            <div class="radio col-sm-10">
                                <input type="radio" name="livingStatus" value="01" class="minimal"
                                       style="left: 10px">单独居住
                                <input type="radio" name="livingStatus" value="02" class="minimal">只与配偶同住
                                <input type="radio" name="livingStatus" value="03" class="minimal">只与子女同住
                                <input type="radio" name="livingStatus" value="04" class="minimal">与配偶及子女同住
                                <input type="radio" name="livingStatus" value="05" class="minimal">与他人同住(其他亲戚或照料者同住)
                                <input type="radio" name="livingStatus" value="06" class="minimal">养老院
                                <input type="radio" name="livingStatus" value="07" class="minimal">其他
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">
                                受教育程度：
                            </label>
                            <div class="radio col-sm-10">
                                <input type="radio" name="educationStatus" value="01" class="minimal">小学及以下
                                <input type="radio" name="educationStatus" value="02" class="minimal">初中
                                <input type="radio" name="educationStatus" value="03" class="minimal">中专/高中
                                <input type="radio" name="educationStatus" value="04" class="minimal">大专/大本
                                <input type="radio" name="educationStatus" value="05" class="minimal">硕士及以上
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="control-label col-sm-2">
                                是否已退休：
                            </label>
                            <div class="radio col-sm-10">
                                <input type="radio" name="retired" value="是" class="minimal">是
                                <input type="radio" name="retired" value="否" class="minimal">否
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">
                                职业（退休前职业）：
                            </label>
                            <div class="radio col-sm-10">
                                <input type="radio" name="profession" value="01" class="minimal">国家机关、党群组织、企业、事业单位负责人
                                <input type="radio" name="profession" value="02" class="minimal">专业技术人员
                                <input type="radio" name="profession" value="03" class="minimal">办事人员和有关人员
                                <input type="radio" name="profession" value="04" class="minimal">商业、服务业人员
                                <input type="radio" name="profession" value="05" class="minimal">农、林、牧、渔、水利业生产人员
                                <input type="radio" name="profession" value="06" class="minimal">生产、运输设备操作人员及有关人员
                                <input type="radio" name="profession" value="07" class="minimal">军人
                                <input type="radio" name="profession" value="08" class="minimal">不便分类的其他从业人员
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">
                                本人年均收入：
                            </label>
                            <div class="radio col-sm-10">
                                <input type="radio" name="income" value="01" class="minimal">5千元以下
                                <input type="radio" name="income" value="02" class="minimal">5千-1万
                                <input type="radio" name="income" value="03" class="minimal">1万-2万
                                <input type="radio" name="income" value="04" class="minimal">2万元以上
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">
                                主要医疗付费方式：
                            </label>
                            <div class="radio col-sm-10">
                                <input type="radio" name="paymentMethod" value="01" class="minimal">城镇职工基本医疗保险
                                <input type="radio" name="paymentMethod" value="02" class="minimal">新城镇居民基本医疗保险
                                <input type="radio" name="paymentMethod" value="03" class="minimal">新型农村合作医疗
                                <input type="radio" name="paymentMethod" value="04" class="minimal">商业医疗保险
                                <input type="radio" name="paymentMethod" value="05" class="minimal">全公费
                                <input type="radio" name="paymentMethod" value="06" class="minimal">全自费
                                <input type="radio" name="paymentMethod" value="07" class="minimal">其他社会保险
                                <input type="radio" name="paymentMethod" value="08" class="minimal">贫困救助
                                <input type="radio" name="paymentMethod" value="09" class="minimal">其他
                            </div>
                        </div>

                        <div class="box box-info" style="box-shadow: none;margin-bottom: 0;">
                            <div class="box-header with-border">
                                <h3 class="box-title">通讯及联系方式</h3>
                            </div>
                            <div class="box-body">
                                <div class="form-group">
                                    <label for="address" class="col-sm-2 control-label">户籍地址：</label>
                                    <div class="col-sm-4">
                                        <input type="text" name="address" class="form-control" id="address"
                                               placeholder="省市区/县街道/乡镇居（村）委会">
                                    </div>

                                    <label for="postcode" class="col-sm-2 control-label">邮编（选填）：</label>
                                    <div class="col-sm-4">
                                        <input type="text" name="postcode" class="form-control" id="postcode"
                                               placeholder="邮编">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="presentAddress" class="col-sm-2 control-label">现户籍地址：</label>
                                    <div class="col-sm-4">
                                        <input type="text" name="presentAddress" class="form-control"
                                               id="presentAddress"
                                               placeholder="省市区/县街道/乡镇居（村）委会">
                                    </div>

                                    <label for="presentPostcode" class="col-sm-2 control-label">邮编（选填）：</label>
                                    <div class="col-sm-4">
                                        <input type="text" name="presentPostcode" class="form-control"
                                               id="presentPostcode"
                                               placeholder="邮编">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="mobileNumber" class="col-sm-2 control-label">联系手机：</label>
                                    <div class="col-sm-2">
                                        <input type="text" name="phone" class="form-control" id="phone"
                                               placeholder="联系手机">
                                    </div>
                                    <label for="number" class="col-sm-2 control-label">联系电话：</label>
                                    <div class="col-sm-2">
                                        <input type="text" name="telephone" class="form-control" id="telephone"
                                               placeholder="联系电话">
                                    </div>
                                    <label for="email" class="col-sm-2 control-label">电子邮箱（选填）：</label>
                                    <div class="col-sm-2">
                                        <input type="text" name="email" class="form-control" id="email"
                                               placeholder="电子邮箱">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="contactName" class="col-sm-2 control-label">主要联系人姓名：</label>
                                    <div class="col-sm-4">
                                        <input type="text" name="contactName" class="form-control" id="contactName"
                                               placeholder="主要联系人姓名">
                                    </div>
                                    <label for="contactMobileNumber" class="col-sm-2 control-label">联系人手机：</label>
                                    <div class="col-sm-4">
                                        <input type="text" name="contactPhone" class="form-control"
                                               id="contactPhone" placeholder="联系人手机">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="relation" class="col-sm-2 control-label">与本人关系：</label>
                                    <div class="radio col-sm-10">
                                        <input type="radio" name="relation" value="父母" class="minimal">父母
                                        <input type="radio" name="relation" value="配偶" class="minimal">配偶
                                        <input type="radio" name="relation" value="子女" class="minimal">子女
                                        <input type="radio" name="relation" value="兄弟姐妹" class="minimal">兄弟姐妹
                                        <input type="radio" name="relation" value="其他" class="minimal">其他
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /.box-body -->
            <div class="box-footer">
                <button type="button" class="btn btn-info btn-lg middleBtn" id="signIn">保存</button>
            </div>
            <!-- /.box-footer -->
        </form>
    </div>
    <script>

        $(function () {
            if (canUpdate != null && canUpdate != undefined && !canUpdate) {
                $("#signIn").hide();
            }
        });
        $("#signIn").click(function () {
            let d = {};
            let t = $('#baseInfoForm').serializeArray();
            $.each(t, function () {
                d[this.name] = this.value;
            });
            d["screenDate"] = $("#screenDate").val();
            d["area"] = $("#area").val();
            d["screenOrganCode"] = $("#screenOrganCode").val();
            //getCheckboxValue("testCheckBox", d);
            let idCard = d["idCard"];
            if (idCard != "") {
                let age = GetAge(idCard);
                if (age > 150) {
                    alert("身份证号输入有误,导致年龄计算出错,请正确填写年龄,并核实身份证号!");
                    $("#age").val("");
                    return false;
                }
                d["age"] = age;
            }
            let data = JSON.stringify(d);
            console.log("baseInfo:", data);
            ajaxLoading("正在提交数据...");
            $.post("/infoCollection/save", {type: "baseInfo", id: $("#screenId").val(), data: data}, function (resp) {
                ajaxLoadEnd();
                if (resp.code == 0) {
                    toastr.success(resp.msg, '', {"positionClass": "toast-top-center"});
                    window.localStorage.setItem("currentTab", "baseInfo");
                    setTimeout(function () {
                        let id = resp.data.id;
                        window.location.href = "/infoCollection/add/" + id;
                    }, 500);
                } else {
                    toastr.warning(resp.msg, '提示', {
                        "progressBar": true,
                        "positionClass": "toast-top-center",
                        "timeOut": "5000",
                        "closeButton": true
                    });
                }
            });
        });

        function baseInfoInit(baseInfoData) {
            //console.log("baseInfo:", baseInfoData);
            $("#baseInfoForm").initForm({jsonValue: baseInfoData, isDebug: false});
            let idCard = baseInfoData.idCard;
            //alert(idCard);
            if (idCard != "") {
                let age = GetAge(idCard);
                //alert(age);
                if (age != "") {
                    if (age > 150) {
                        alert("身份证号输入有误,导致年龄计算出错,请正确填写年龄,并核实身份证号!");
                        $("#age").val("");
                    } else {
                        $("#age").val(age);
                    }
                }
            }
        }
    </script>
{{end}}